#ifndef VISIMAGEWRAPPER_H
#define VISIMAGEWRAPPER_H

#include "ImageWrapperBase.h"
#include "VisWidgetBase.h"
#include "SlicerWidget.h"
#include "VolumeWidget.h"

#include "itkLabelMapToLabelImageFilter.h"
#include "itkImageToVTKImageFilter.h"
#include "itkSmartPointer.h"

#include <QList>
#include <QMap>

class VisImageWrapper : public ImageWrapperBase
{
    Q_OBJECT

public:
    typedef vtkSmartPointer<vtkContourFilter> ContourFilterPointer;
    typedef vtkSmartPointer<vtkPolyDataNormals> PolyDataNormalsPointer;

    typedef itk::LabelMapToLabelImageFilter<LabelMapType, BinaryImageType> LabelToGreyFilterType;
    typedef LabelToGreyFilterType::Pointer LabelToGreyFilterPointer;

  //  typedef QMap<int, PolyDataPointer> VolumeMap;

    typedef QList<VisWidgetBase*> VisWidgetListType;
    typedef VisWidgetListType::Iterator VisWidgetListIterator;

    typedef QList<SlicerWidget*> SlicerListType;
    typedef SlicerListType::Iterator SlicerListIterator;

    VisImageWrapper();
    ~VisImageWrapper() {}

    void SetImage(GreyImageType* displayImage);

    void SetVolume(Material *material);
    void ShowVolume(int label);
    void HideVolume(int label);

    VisWidgetBase *GetWidget(VisWidgetBase::VisWidgetType type);

public slots:
    void SeedPointPicked(double *pos);

signals:
    void SeedPointAccepted(double x, double y, double z);

private:
    template <class TInputImageType>
    DisplayImageType* ConvertITKToVTK(TInputImageType* inputImage);

    LabelToGreyFilterPointer m_LabelToGreyFilter;

    VisWidgetListType m_VisWidgets;
    SlicerListType m_Slicers;

    SlicerWidget *m_AxialSlicer, *m_CoronalSlicer, *m_SagittalSlicer;
    VolumeWidget *m_VolumeWidget;
};

#endif

